<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org">
<meta charset="utf-8">
<head th:include="include :: header"></head>
<link th:href="@{/mayioa/css/mayioa-ui.css}" rel="stylesheet"/>
<link th:href="@{/ajax/libs/datapicker/datepicker3.css}" rel="stylesheet"/>
<link th:href="@{/ajax/libs/layui/css/layui.css}" rel="stylesheet"/>
<body class="white-bg">
<div class="wrapper wrapper-content animated fadeInRight ibox-content">
    <form class="form-horizontal m" id="form-staffmanager-edit" th:object="${staffManagerInfo}">




        <div class="form-group">
            <label class="col-sm-3 control-label ">员工编号：</label>
            <div class="col-sm-8">
                <input class="form-control" type="text"  name="id" readonly="true" th:field="*{id}" />
            </div>
        </div>

        <div class="form-group">
            <label class="col-sm-3 control-label ">员工工号：</label>
            <div class="col-sm-8">
                <input class="form-control" type="text"  name="idCode" readonly="true" th:field="*{idCode}" minlength="6" maxlength="6"/>
            </div>
        </div>

        <div class="form-group">
            <label class="col-sm-3 control-label ">员工姓名：</label>
            <div class="col-sm-8">
                <input class="form-control" type="text"  name="name"  th:field="*{name}"/>
            </div>
        </div>

        <div class="form-group">
            <label class="col-sm-3 control-label">员工性别：</label>
            <div class="col-sm-8">
                <input class="form-control" type="text" name="sex"  id="sex" th:field="*{sex}">
            </div>
        </div>

        <div class="form-group">
            <label class="col-sm-3 control-label">电话号码：</label>
            <div class="col-sm-8">
                <input class="form-control" type="text" name="phone"  id="phone" th:field="*{phone}" minlength="11" maxlength="11">
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-3 control-label">员工邮箱：</label>
            <div class="col-sm-8">
                <input class="form-control" type="text" name="email" id="email" th:field="*{email}">
            </div>
        </div>

        <div class="form-group">
            <label class="col-sm-3 control-label">员工住址：</label>
            <div class="col-sm-8">
                <input class="form-control" type="text" name="address" id="address" th:field="*{address}">
            </div>
        </div>


        <div class="form-group">
            <label class="col-sm-3 control-label">入职日期：</label>
            <div class="col-sm-8">
                <input class="form-control" type="date" name="joinDate" id="joinDate" th:field="*{joinDate}">
            </div>
        </div>



        <div class="form-group">
            <label class="col-sm-3 control-label">在职状态：</label>
            <div class="col-sm-8">
                <input class="form-control m-b" type="text" name="status" id="status" th:field="*{status}">
            </div>
        </div>

        <div class="form-group">
            <label class="col-sm-3 control-label">员工地域：</label>
            <div class="col-sm-8">
                <input class="form-control" type="text" name="region" id="region" th:field="*{region}">
            </div>
        </div>

        <div class="form-group">
            <label class="col-sm-3 control-label">员工技能：</label>
            <div class="col-sm-8">
                <input class="form-control" type="text" name="skillType" id="skillType" th:field="*{skillType}">
            </div>
        </div>


        <div class="form-group">
            <label class="col-sm-3 control-label">员工等级：</label>
            <div class="col-sm-8">
                <input class="form-control" type="text" name="level" id="level" th:field="*{level}">
            </div>
        </div>

    </form>
</div>
<div th:include="include::footer"></div>
<script th:src="@{/ajax/libs/select/select2.js}"></script>
<script th:src="@{/js/jquery-ui-1.10.4.min.js}"></script>
<script th:src="@{/ajax/libs/iCheck/icheck.min.js}"></script>
<script th:src="@{/ajax/libs//datapicker/bootstrap-datepicker.js}"></script>
<script th:src="@{/ajax/libs/beautifyhtml/beautifyhtml.js}"></script>
<script th:src="@{/ajax/libs/layui/lay/modules/upload.js}"></script>

<script>


    $("#form-staffmanager-edit").validate({
        rules: {

            idCode: {
                required: true
            },
            name: {
                required: true
            },
            sex: {
                required: true
            },
            phone: {
                required: true
            },
            email: {
                required: true
            },
            address: {
                required: true
            }
        },
        messages: {
            "name": {
                remote: "姓名不能为空"
            }
        },
        submitHandler: function (form) {
            submitHandler();
        }
    });

    function submitHandler() {
        if ($.validate.form()) {
            edit();
        }
    }

    function changeCompleteStatus(status) {
        $("#wbCodeDiv").hide();
        $("#candidateNameDiv").hide();
        $("#confirmHwLevelDiv").hide();
        $("#consumeDatelDiv").hide();
        $("#gooseDiv").hide();
        if (status == "1" || status == "4") {
            $("#wbCodeDiv").show();
            $("#candidateNameDiv").show();
            $("#confirmHwLevelDiv").show();
            $("#consumeDatelDiv").show();
            $("#gooseDiv").show();
        }
    }

    function edit() {
        var id = $("input[name='id']").val();
        var idCode = $("input[name='idCode']").val();
        var name = $("input[name='name']").val();
        var sex = $("input[name='sex']").val();
        var phone = $("input[name='phone']").val();
        var email = $("input[name='email']").val();
        var address = $("input[name='address']").val();
        var joinDate = $("input[name='joinDate']").val();
        var status = $("input[name='status']").val();
        var region = $("input[name='region']").val();
        var skillType = $("input[name='skillType']").val();
        var level = $("input[name='level']").val();
        $.ajax({
            cache: true,
            type: "POST",
            url: ctx + "staffmanager/list/edit",
            data: {
                "id": id,
                "idCode": idCode,
                "name": name,
                "sex": sex,
                "phone": phone,
                "email": email,
                "address": address,
                "joinDate": joinDate,
                "status": status,
                "region": region,
                "skillType": skillType,
                "level": level
            },
            async: false,
            error: function (request) {
                $.modal.alertError("系统错误");
            },
            success: function (data) {
                $.operate.saveSuccess(data);
            }
        });
    }

    layui.use('upload', function () {
        var $ = layui.jquery
            , upload = layui.upload;

    });
</script>
</body>
</html>
